package metier;

import java.util.Date;
import java.util.Vector;

import dao.GestionDonnees;

public class Hospitalisation
{
	private int numero; 
	private String descriptif;
	private java.util.Date dateEntree;
	private java.util.Date dateSortie;
	private Patient unPatient;
	

	public Hospitalisation()
	{
		
	}
	
	public Hospitalisation(String descriptif, Date dateEntree, Patient unPatient)
	{
		this.descriptif = descriptif;
		this.dateEntree = dateEntree;
		this.unPatient = unPatient; 
	}
	public Hospitalisation(int numero, String descriptif, Date dateEntree,Date dateSortie, Patient unPatient)
	{
		this.numero = numero;
		this.descriptif = descriptif;
		this.dateEntree = dateEntree;
		this.dateSortie = dateSortie;
		this.unPatient = unPatient; 
	}
	

	public int getNumero()
	{
		return numero;
	}

	public void setNumero(int numero)
	{
		this.numero = numero;
	}

	public String getDescriptif()
	{
		return descriptif;
	}

	public void setDescriptif(String descriptif)
	{
		this.descriptif = descriptif;
	}

	public java.util.Date getDateEntree()
	{
		return dateEntree;
	}

	public void setDateEntree(java.util.Date dateEntree)
	{
		this.dateEntree = dateEntree;
	}

	
	public java.util.Date getDateSortie()
	{
		return dateSortie;
	}
	
	public void setDateSortie(java.util.Date dateSortie)
	{
		this.dateSortie = dateSortie;
	}
	
	public Patient getUnPatient()
	{
		return unPatient;
	}

	public void setUnPatient(Patient unPatient)
	{
		this.unPatient = unPatient;
	}

	// retourne true si l'hospitalisation est en cours sinon false
	public boolean hospitalisationEnCours()
	{
		boolean res = false; 
			if (this.getDateSortie()==null)
			{
				res= true; 
			}
			
		return res;		
	}
	
	@Override
	public String toString()
	{
		GestionDonnees sql = new GestionDonnees();
		return "Hospitalisation [numero=" + numero + ", descriptif="
				+ descriptif + ", dateEntree=" + sql.dateVersStrFr(dateEntree) + ", dateSortie="
				+ dateSortie + ", unPatient="  + unPatient.getNom() + " " + unPatient.getPrenom() + "]";
	}
	
	
}
